import { Hooks } from 'dva';
import { PersistConfig } from 'redux-persist';
import storage from 'redux-persist/lib/storage';
// @ts-ignore
import { storageEnhancer } from 'dva-redux-persist';

const persistConfig: PersistConfig<any> = {
  key: 'aps_ad_01',
  storage: storage,
  whitelist: ['user'],
};

const dvaConfig: Hooks = {
  extraEnhancers: [storageEnhancer(persistConfig)],
};

export const dva = { config: dvaConfig };
